package com.wanmait.studentmangers.controller;

import com.wanmait.studentmangers.service.UserinfoService;
import com.wanmait.studentmangers.service.UserinfoServiceImpl;
import com.wanmait.studentmangers.vo.Userinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("userinfo")
@CrossOrigin
public class UserinfoController {
    @Autowired
    private UserinfoService userinfoService;
    @RequestMapping("registe")
    public String registe (Userinfo userinfo) {

        userinfoService.insert(userinfo);
        return "success";
    }
    @RequestMapping("login")
    public String login (Userinfo userinfo) {
       boolean f =  userinfoService.login(userinfo);
       if (f){
           return "success登录成功";
       }
       return "fail登录失败";
    }
    @RequestMapping("list")
    public List<Userinfo> list() {
        List<Userinfo> userinfoList = userinfoService.getAll();
         return userinfoList;
    }
    @RequestMapping("insert")
    public  void insert ( @RequestBody  Userinfo userinfo){

    }
}
